<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />

<title>无标题文档</title>

<style>
div{width:200px;height:300px;border:1px solid #ddd;}
</style>
<script src="../第十三章事件/eventObject.js" type="text/javascript"></script>
</head>

<body>
	<form id="myForm"  method="post" name="form1" action="http://www.baidu.com" novalidate='true'>
    	<select name="location" id="selLocation">
        	<option>000</option>
            <option>111</option>
            <option>222</option>
            <option>333</option>
        </select>
        
    </form>
    <script> 
		
		//第一种移除选项的方式(DOM方法)
		var selectbox=document.forms[0].elements['location'];
		
		//selectbox.removeChild(selectbox.options[0]);
		//第二种
		//selectbox.remove(0);
		
		//第三种
		//selectbox.options[0]=null;
		
		function clearSelectbox(selectbox){
			
			for(var i=0, len=selectbox.options.length; i<len; i++){
				
				selectbox.remove(0);
				
			};
			
		};
		
		clearSelectbox(selectbox);
		
    </script>
    
</body>
</html>
